package com.sleepcamel.rest.domain.util;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class ResourceUtils {

	public static String readResourceAsString(String resourceName) {
		InputStream resourceAsStream = ResourceUtils.class.getClassLoader().getResourceAsStream(resourceName);
		BufferedReader br = new BufferedReader(new InputStreamReader(resourceAsStream));
		String line = null;
		StringBuffer sb = new StringBuffer();
		try {
			while ((line = br.readLine()) != null) {
				sb.append(line);
			}
		} catch (IOException ex) {
		}
		try {
			br.close();
		} catch (IOException ex) {
		}

		return sb.toString();
	}

}
